// 轮播部分
var swiperUl = document.querySelector('.swiper');
        var swiperPoints = document.querySelector('.swiper-points').children;
        var count = 1;
        //每隔一秒  改变图片的位置
        setInterval(function(){
          count++;
          // console.log(count);
          swiperUl.style.transition = 'all .4s ease';
          swiperUl.style.transform = 'translateX(-'+count*10+'%)';
          for(var i = 0 ;i < swiperPoints.length;i++){
            swiperPoints[i].setAttribute('class','');
            if(count == 4){
              swiperPoints[0].classList.add('current');
            }else{
              swiperPoints[count-1].classList.add('current');
            }
          }
        },5000)
        //count=4 实际上跑到了第5张   在本轮次结束时加上监听事件
          swiperUl.addEventListener('transitionend',function(){
            if(count >= 4){
              count = 1;
              //过渡置空
              swiperUl.style.transition = '';
              swiperUl.style.transform = 'translateX(-'+count*10+'%)';
            }
})
//导航栏的显示与消失
var navShow = document.getElementsByClassName("nav-menu")[0];
var navItem = document.getElementsByClassName("nav-item")[0].children[0];
var navMenu = document.getElementsByClassName("nav-menu")[0];
// 第二个导航
var navShow2 = document.getElementsByClassName("nav-menu2")[0];
var navItem2 = document.getElementsByClassName("nav-item")[1].children[0];
var navMenu2 = document.getElementsByClassName("nav-menu2")[0];


// 第四个导航
var navShow4 = document.getElementsByClassName("nav-menu4")[0];
var navItem4 = document.getElementsByClassName("nav-item")[4].children[0];
var navMenu4 = document.getElementsByClassName("nav-menu4")[0];
console.log(navShow4)

var isShow = false;

navItem.onmouseover = function (){
	if(!isShow){
		navShow.style.display = "block";
	}
}
navMenu.onmouseover = function (){
	if(!isShow){
		navShow.style.display = "block";
	}
}
navItem.onmouseout = function (){
	if(!isShow){
		navShow.style.display = "none";
	}
}
navMenu.onmouseout = function (){
	if(!isShow){
		navShow.style.display = "none";
	}
}

navItem2.onmouseover = function (){
	if(!isShow){
		navShow2.style.display = "block";
	}
}
navMenu2.onmouseover = function (){
	if(!isShow){
		navShow2.style.display = "block";
	}
}
navItem2.onmouseout = function (){
	if(!isShow){
		navShow2.style.display = "none";
	}
}
navMenu2.onmouseout = function (){
	if(!isShow){
		navShow2.style.display = "none";
	}
}
// 第四个
navItem4.onmouseover = function (){
	if(!isShow){
		navShow4.style.display = "block";
	}
}
navMenu4.onmouseover = function (){
	if(!isShow){
		navShow4.style.display = "block";
	}
}
navItem4.onmouseout = function (){
	if(!isShow){
		navShow4.style.display = "none";
	}
}
navMenu4.onmouseout = function (){
	if(!isShow){
		navShow4.style.display = "none";
	}
}

// 最新动态的上下轮播
	var speed1 = 60; //数字越大速度越慢
	    var tabItem=document.getElementById("new");
	    var tabItem1=document.getElementById("new1");
	    var tabItem2=document.getElementById("new2");
	    tabItem2.innerHTML=tabItem1.innerHTML;
	    function Marquee1(){
			if(tabItem.scrollTop>= tabItem1.offsetHeight){
				tabItem.scrollTop=0; 
			}
			else{
				tabItem.scrollTop++;
			}
	    }
	    var MyMar1=window.setInterval(Marquee1,speed1);
	    tabItem.onmouseover=function(){
			window.clearInterval(MyMar1)
		};
	    tabItem.onmouseout=function(){
			MyMar1=window.setInterval(Marquee1,speed1)
		};
// 跑马灯 
// <!-- 用JS判断浏览器当前的模式： -->
// document.write(document.compatMode == "CSS1Compat" ? "当前处于标准模式" : "当前处于混杂模式");
    var speed=20; //数字越大速度越慢
    var tab=document.getElementById("demo");
    var tab1=document.getElementById("demo1");
    var tab2=document.getElementById("demo2");
    tab2.innerHTML=tab1.innerHTML;
	// <!-- alert(tab2.offsetWidth); -->
    function Marquee(){
		if(tab.scrollLeft>= tab1.offsetWidth){
			tab.scrollLeft=0;  //js中offsetWidth是指对象自身的宽度，整型，单位像素（含边线，如滚动条的占用的宽，值会随着内容的输入而不断改变）。
			                                                 // scrollLeft 代表页面利用滚动条滚动到右侧时，隐藏在滚动条左侧的页面的宽度
		}
		else{
			tab.scrollLeft++;
		}
    }
    var MyMar=window.setInterval(Marquee,speed);
    tab.onmouseover=function(){
		window.clearInterval(MyMar)
	};
    tab.onmouseout=function(){
		MyMar=window.setInterval(Marquee,speed)
	};